#include <mimalloc.h>
#include <utl/allocator.h>

namespace utl
{
	/*struct HEAP_DELETER
	{
		void operator()(mi_heap_t* ptr)const noexcept
		{
			mi_heap_destroy(ptr);
		}
	};

	using heap_ptr = eastl::unique_ptr<mi_heap_t, HEAP_DELETER>;

	static heap_ptr& get_heap_ptr()
	{
		static heap_ptr hp{ mi_heap_new() };
		return hp;
	}*/

	void* allocator::allocate(unsigned long n, int flags)
	{
		return mi_malloc(n);
	}

	void* allocator::allocate(unsigned long n, unsigned long alignment, unsigned long offset, int flags)
	{
		return mi_malloc(n);
	}

	void  allocator::deallocate(void* p, unsigned long n)
	{
		mi_free(p);
	}

	bool operator==(const allocator& a, const allocator& b)
	{
		return true;
	}

	bool operator!=(const allocator& a, const allocator& b)
	{
		return false;
	}
}